package edu.depaul.se.courseregistration.webservice;

import edu.depaul.se.courseregistration.jpa.user.Person;
import edu.depaul.se.courseregistration.sessionbean.PersonSession;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

/**
 * 
 * @author xchen
 */


//@WebService(serviceName = "PersonService")
@Stateless()
public class PersonService {

    @EJB
    private PersonSession personSession;

    @WebMethod(operationName = "GetAllUser")
    public List<Person> getAllUsers() {
        return personSession.getAllUsers();
    }

    @WebMethod(operationName = "FindPersonById")
    public Person findPersonById(@WebParam (name = "personID") int personID) {
        return personSession.findPersonById(personID);
    }

    @WebMethod(operationName = "FindPersonByFirstName")
    public Person findPersonByFirstName(@WebParam (name = "firstName") String firstName) {
        return personSession.findPersonByFirstName(firstName);
    }

    @WebMethod(operationName = "FindPersonByLastName")
    public Person findPersonByLastName(@WebParam (name = "lastName") String lastName) {
        return personSession.findPersonByLastName(lastName);
    }

    @WebMethod(operationName = "FindPersonByEmail")
    public Person findPersonByEmail(@WebParam (name = "email") String email) {
        return personSession.findPersonByEmail(email);
    }
}
